CC = g++
CFLAGS = -pthread 

tftp: tftp.o ClientController.o ConfigChanger.o FileList.o GlobalServer.o Log.o MacCollector.o ServerThread.o MessageExecutor.o MessageACK.o MessageError.o  MessageRRQ.o MessageDataPackage.o MessageWRQ.o
	$(CC) $(CFLAGS) tftp.o ClientController.o ConfigChanger.o FileList.o GlobalServer.o Log.cpp MacCollector.o ServerThread.o MessageExecutor.o MessageACK.o MessageError.o MessageRRQ.o MessageDataPackage.o MessageWRQ.o -o tftp
	
tftp.o: tftp.cpp messages/MessageExecutor.h messages/MessageACK.h messages/MessageError.h messages/MessageRRQ.h ClientController.h FileList.h Log.h ServerThread.h GlobalServer.h structures.h
	$(CC) -c $(CFLAGS) tftp.cpp -o tftp.o
	
ClientController.o: ClientController.cpp ClientController.h structures.h ServerThread.h messages/MessageExecutor.h messages/MessageRRQ.h messages/MessageACK.h messages/MessageError.h messages/MessageWRQ.h messages/MessageDataPackage.h Log.h
	$(CC) -c $(CFLAGS) ClientController.cpp -o ClientController.o 
	
ConfigChanger.o: ConfigChanger.cpp ConfigChanger.h Log.h FileList.h structures.h
	$(CC) -c $(CFLAGS) ConfigChanger.cpp -o ConfigChanger.o
	
FileList.o: FileList.cpp FileList.h Log.h
	$(CC) -c $(CFLAGS) FileList.cpp -o FileList.o
	
GlobalServer.o: GlobalServer.cpp GlobalServer.h ConfigChanger.h ClientController.h MacCollector.h structures.h Log.h 
	$(CC) -c $(CFLAGS) GlobalServer.cpp -o GlobalServer.o
	
Log.o: Log.cpp Log.h
	$(CC) -c $(CFLAGS) Log.cpp -o Log.o
	
MacCollector.o: MacCollector.cpp Log.h MacCollector.h
	$(CC) -c $(CFLAGS) MacCollector.cpp -o MacCollector.o
	
ServerThread.o: ServerThread.cpp ServerThread.h Log.h structures.h
	$(CC) -c $(CFLAGS) ServerThread.cpp -o ServerThread.o

MessageExecutor.o: messages/MessageExecutor.cpp messages/MessageExecutor.h
	$(CC) -c $(CFLAGS) messages/MessageExecutor.cpp -o MessageExecutor.o
	
MessageACK.o: messages/MessageACK.cpp messages/MessageACK.h structures.h ClientController.h Log.h FileList.h MacCollector.h
	$(CC) -c $(CFLAGS) messages/MessageACK.cpp -o MessageACK.o
	
MessageError.o: messages/MessageError.cpp messages/MessageError.h Log.h FileList.h
	$(CC) -c $(CFLAGS) messages/MessageError.cpp -o MessageError.o
	
	
MessageRRQ.o: messages/MessageRRQ.cpp messages/MessageRRQ.h Log.h FileList.h structures.h MacCollector.h
	$(CC) -c $(CFLAGS) messages/MessageRRQ.cpp -o MessageRRQ.o

MessageDataPackage.o: messages/MessageDataPackage.cpp messages/MessageDataPackage.h Log.h
	$(CC) -c $(CFLAGS) messages/MessageDataPackage.cpp -o MessageDataPackage.o

MessageWRQ.o: messages/MessageWRQ.cpp messages/MessageWRQ.h Log.h
	$(CC) -c $(CFLAGS) messages/MessageWRQ.cpp -o MessageWRQ.o




clean:
	rm -f *.o

cleanall:
	rm -f *.o tftp
